﻿/***********************************************
  [className] CPdfRptBase
  [func]      pdf报表业务基类
  [author]    WeiXiaoYu
  [date]      2025/01/08 16:00
  [log]       初次建立
[Modification Log]
Vers            By            Notes
************************************************/

#ifndef CPdfRptBase_H
#define CPdfRptBase_H
#include <QMap>
#include "CPdfRptTool.h"
#include "CPdfRptRestAiOperBase.h"

//AI检测单个报警信息
struct SPdfExtraAiAlmInfo
{
public:
	QString sCamerName;
	QString sCamerIp;
	QString sAlmTime;//报警时间
	QString sUrl;//Http图片地址
	QString sEventType;
	QString sAlarmLevel;
	QString sIsConfrim;
	QString sCamerUser;
	QString sCamerPassWd;

	SPdfExtraAiAlmInfo()
	{
		sCamerName = "";
		sCamerIp = "";
		sAlmTime = "";
		sUrl = "";
		sEventType = "";
		sAlarmLevel = "";
		sIsConfrim = "";
	}
};

//检测报表数据信息
class CPdfRptExtraAiDataInfo
{
public:
	QString m_sOutputPdfFolder;//输出pdf文件夹(完整本地路径)
	QString m_sDetTime;//检测日期 2024-05-13
	int m_nAlmCount;//报警总项数
	int m_nCoalFlow;						//煤流量报警总项数
	int m_nBeltForeign;						//皮带异物报警总项数
	int m_nLargeCoal;						//大块煤报警总项数
	int m_nBeltDeviation;					//皮带跑偏报警总项数
	int m_nSafetyHelmet;					//安全帽反光衣报警总项数
	int m_nSmokeFire;						//烟雾火点报警总项数
	int m_nTemp;							//测温报警总项数
	int m_nSmokeMakeCall;					//抽烟打电话报警总项数
	int m_nPerimeter;						//周界防范报警总项数
	QString m_sDetStartTime;//检测开始时间 15:27:20
	QString m_sDetEndTime;//检测结束时间 16:30:45
	QMap<QString, QVector<SPdfExtraAiAlmInfo>> m_mapExtraAiInfo;//其他AI检测报警map

	CPdfRptExtraAiDataInfo()
	{
		m_sOutputPdfFolder = "";
		m_sDetTime = "";
		m_nAlmCount = 0;
		m_nCoalFlow = 0;
		m_nBeltForeign = 0;
		m_nLargeCoal = 0;
		m_nBeltDeviation = 0;
		m_nSafetyHelmet = 0;
		m_nSmokeFire = 0;
		m_nSmokeMakeCall = 0;
		m_nTemp = 0;
		m_nPerimeter = 0;
		m_sDetStartTime = "";
		m_sDetEndTime = "";
	}
};


//所有pdf报表数据集合
class CAllPdfRptDataInfo
{
public:
	CPdfRptExtraAiDataInfo extraAiDataInfo;//AI检测报表数据信息

	CAllPdfRptDataInfo()
	{

	}
};

class CPdfRptBase  : public QObject
{
	Q_OBJECT

public:
	CPdfRptBase();
	virtual ~CPdfRptBase();

	/***************************************************************
	* @brief     函数功能:绘制报告名称
	* @input     sRptName|报告名称
	* @input     ePosition|绘制位置枚举
	* @input     painter|QPainter对象
	* @input     printer|QPrinter对象
	* @output    sErrMsg|错误描述
	* @return    bool |成功返回true，失败返回false
	* @note
	* @author    WeiXiaoYu
	* @time      2025-01-08 13:30
	* @Modification Log]
	 Vers            By            Notes
	**************************************************************/
	bool drawRptName(QString sRptName, EPdfRptComPosition ePosition, QPainter &painter, QPrinter &printer, QString &sErrMsg);

	/***************************************************************
	* @brief     函数功能:输出其他AI检测报表信息
	* @input     dataInfo|pdf报表数据
	* @output    sErrMsg|错误描述
	* @return    bool |成功返回true，失败返回false
	* @note      备注
	* @author    WeiXiaoYu
	* @time      2025-01-08 17:00
	* @Modification Log]
	 Vers            By            Notes
	**************************************************************/
	bool optRestAiPdfRptInfo(CAllPdfRptDataInfo &dataInfo, QString &sErrMsg);//输出其他AI检测报表信息

public:
	CPdfRptTool *m_pPdfRptTool = nullptr;//声明工具类指针 (在子类中new,并且传入操作类中)
	CPdfRptRestAiOperBase *m_pPdfRptRestAiOperBase = nullptr;//声明其他AI检测操作基类
};
#endif
